package com.fanqwz.kotlinmvvm.data.persist.po

import android.arch.persistence.room.Entity
import android.arch.persistence.room.PrimaryKey
import com.fanqwz.kotlinmvvm.data.persist.UserConstants
import com.fanqwz.kotlinmvvm.data.web.entity.UserEntity

/**
 * Created by fanqwz on 2018/3/9.
 */

@Entity(tableName = UserConstants.TABLE_NAME)
data class UserPO(
        @PrimaryKey
        var id: Long? = null,
        val code: String,
        val name: String,
        val password: String
)

fun UserPOfromEntity(user: UserEntity): UserPO {
    return UserPO(null,
            user.code ?: "",
            user.name ?: "",
            user.passwd ?: "")
}
